﻿// (c) Copyright Microsoft Corporation.
// This source is subject to the Microsoft Public License (Ms-PL).
// Please see http://go.microsoft.com/fwlink/?LinkID=131993 for details.
// All other rights reserved
// Developer:  Michael Antonio
using System;
using System.Collections.Generic;
using System.Linq;

namespace MichMan.Utilities.Requests
{
    /// <summary>
    /// Global cache.
    /// </summary>
    public class LocalCache : CacheWrapper
    {
        protected override ICache GetWrapped()
        {
            return _cache ?? (_cache = new DictionaryCache());
        }
       
        private static DictionaryCache _cache = new DictionaryCache();
    }

    /// <summary>
    /// Caches stuff on a per-thread basis.
    /// </summary>
    public class ThreadLocalCache : CacheWrapper
    {
        [ThreadStaticAttribute]
        private static DictionaryCache _cache = null;

        protected override ICache GetWrapped()
        {
            return _cache ?? (_cache = new DictionaryCache());
        }
    }
}
